<?php

namespace register\model;

require_once("./login/model/UserList.php");
require_once("./register/model/RegisterObserver.php");

class RegisterModel {
	private $userList;

	public function __construct() {
		$this->userList = new \login\model\UserList();
	}

	public function doRegister(\login\model\UserCredentials $user,
		RegisterObserver $observer) {
		try {
			$this->userList->compareUser($user);
			$user->newTemporaryPassword();
			$this->userList->saveUser($user);
			$observer->registerOK();
		} catch (Exception $e) {}
	}
}